package com.lch.mebatis.v1;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author: liuchenhui
 * @create: 2019-05-09 22:21
 **/
public class LchMapperProxy implements InvocationHandler {

    private LchSqlSession lchSqlSession;

    public LchMapperProxy(LchSqlSession lchSqlSession) {
        this.lchSqlSession = lchSqlSession;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        String statmentId = method.getDeclaringClass().getName() + "." + method.getName();
        return lchSqlSession.selectOne(statmentId, args[0]);
    }
}
